var set_beizhu = document.querySelector(".set-beizhu");
var mask = document.querySelector(".mask");
var change_beizhu = document.querySelector(".change-beizhu");
var username = document.querySelector(".username");
var beizhu_input = document.querySelector(".beizhu-input");
var queding_btn = document.querySelector(".queding-btn");
var cancel_btn = document.querySelector(".cancel-btn");

set_beizhu.addEventListener("click",function(){
    mask.style.display = "block";
    change_beizhu.style.display="block";
})

queding_btn.addEventListener("click",function(){
    username.innerText =beizhu_input.value;
   
    mask.style.display = "none";
    change_beizhu.style.display="none";
})

var phone_num = document.querySelector(".phone-num");
var nickName = document.querySelector(".nickName");
var consume = document.querySelector(".consume");
var order = document.querySelector(".order");
console.log(order);
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange",function(e){
    if(xhr.readyState == 4 && e.target.status == 200){
        var data_json = JSON.parse(e.target.response);
        console.log(data_json);
        phone_num.innerText ="手机："+ data_json.client_ziliao[0].phone_num;
        nickName.innerText = "昵称："+ data_json.client_ziliao[0].nickName;
        consume.innerText = data_json.client_ziliao[0].consume;
        order.innerText = data_json.client_ziliao[0].order;
    }

})

xhr.open("GET","https://www.easy-mock.com/mock/5bab79173567340cc7d3dc8c/YouBeiShop/getAllClient");
xhr.send();

var back_img = document.querySelector(".back-img");

back_img.addEventListener("click",function(){
    goBack();
})